<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../js/vue.js"></script>
</head>
<body>
    <div id="app">
        <h1>数据代理：通过一个对象 代理另一个对象的属性操作（读写） </h1>

    </div>
</body>
<script>
    let obj={x:100};
    let obj1={y:200};
    // 给 obj1 添加属性x
    Object.defineProperty(obj1, "x", {
        get(){
            return obj.x;
        },
        set(val){
            obj.x=val;
        }
    });



    new Vue({
        el: '#app',
        data: {
            msg: 'Hello Vue!'
        }
    })
</script>
</html>